# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-adblockparser
pkgname=('python2-adblockparser' 'python-adblockparser')
_pkgname=adblockparser
pkgver=0.7
pkgrel=6
pkgdesc='Parser for Adblock Plus rules.'
arch=('any')
url='https://pypi.org/project/adblockparser/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('93fc90a08026737f889beec142264b27dae1ccf1f8b6123f072d4f4ef6cb6e595ab045a6bdd3f905ca1f176696b6a4eb6c197232e81ce953f3bdcd7aec69cd78')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-adblockparser() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

package_python-adblockparser() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

